const trickDescriptions = require('../../data/string/string_en').trickDescriptions;

const TrickDescriptionIntent = {
    canHandle(handlerInput) {
        return handlerInput.requestEnvelope.request.type === 'IntentRequest'
            && handlerInput.requestEnvelope.request.intent.name === 'TrickDescriptionIntent';
    },

    handle(handlerInput) {
        var intent = handlerInput.requestEnvelope.request.intent;

        var speechText = "Sorry, I don\'t know what";
        var command = intent.slots.description.value.toLowerCase();
        if (command === 'ollie') {
            speechText = trickDescriptions[0].description;
        } else if (command === '360flip' || command === '360 flip') {
            speechText = trickDescriptions[1].description;
        } else if (command === 'kickflip') {
            speechText = trickDescriptions[2].description;
        } else if (command === 'bs kickflip') {
            speechText = trickDescriptions[3].description;
        } else if (command === 'fs kickflip') {
            speechText = trickDescriptions[4].description;
        } else if (command === 'heelflip') {
            speechText = trickDescriptions[5].description;
        }

        return handlerInput.responseBuilder
            .speak(speechText)
            .reprompt(speechText)
            .withSimpleCard('Okay, I sure that is you want to know.', speechText)
            .getResponse();

    },
};

module.exports = TrickDescriptionIntent;